package com.lin.controller.Machine;

import com.lin.pojo.Form;
import com.lin.response.CommonResp;
import com.lin.service.FormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/machine")
public class MachineController {

    @Autowired
    private FormService formService;

    @GetMapping("/form/select")
    public CommonResp page(@RequestParam Integer pageNum,@RequestParam Integer pageSize){
        return formService.page_All(pageNum,pageSize);
    }

    @PostMapping("/form/transform")
    public CommonResp transform(@RequestBody Form form){
        String flag = form.getFlag();
        if(flag.equals("开始")){
            return formService.transform(form,0);
        }
        else {
            return formService.transform(form,1);
        }
    }
}
